Everything about Scheduling Computing totally explained
Scheduling is a key concept in
computer multitasking and
multiprocessing operating system design, and in
real-time operating system design. It refers to the way
processes are assigned priorities in a
priority queue. This assignment is carried out by software known as a
scheduler.
In
real-time environments, such as
mobile devices for
automatic control in industry (for example
robotics), the scheduler also must ensure that processes can meet
deadlines; this is crucial for keeping the system stable. Scheduled tasks are sent to mobile devices and
managed through an administrative back end.
Types of operating system schedulers
Operating systems may feature up to 3 distinct types of schedulers: a
long-term scheduler (also known as an admission scheduler or high-level), a
mid-term or medium-term scheduler and a
short-term scheduler (also known as a
dispatcher). The names suggest the relative frequency with which these functions are performed.
Long-term Scheduler
The long-term, or admission, scheduler decides which jobs or processes are to be admitted to the
ready queue; that is, when an attempt is made to execute a program, its admission to the set of currently executing processes is either authorized or delayed by the long-term scheduler. Thus, this scheduler dictates what processes are to run on a system and the degree of concurrency to be supported at any one time - ie: whether a high or low amount of processes are to be executed concurrently, and how the split between
IO intensive and
CPU intensive processes is to be handled. Typically for a
desktop computer, there's no long-term scheduler as such, and processes are admitted to the system automatically. However this type of scheduling is very important for a
real time system, as the system's ability to meet process deadlines may be compromised by the slowdowns and contention resulting from the admission of more processes than the system can safely handle. [Stallings,399].
Mid-term Scheduler
The mid-term scheduler, present in all systems with
virtual memory, temporarily removes processes from main memory and places them on secondary memory (such as a disk drive) or vice versa. This is commonly referred to as "swapping out" or "swapping in" (also incorrectly as "
paging out" or "paging in"). The mid-term scheduler may decide to swap out a process which hasn't been active for some time, or a process which has a low priority, or a process which is
page faulting frequently, or a process which is taking up a large amount of memory in order to free up main memory for other processes, swapping the process back in later when more memory is available, or when the process has been unblocked and is no longer waiting for a resource. [Stallings,396] [Stallings,370]
In many systems today (those that support mapping virtual address space to secondary storage other than the swap file), the mid-term scheduler may actually perform the role of the long-term scheduler, by treating binaries as "swapped out processes" upon their execution. In this way, when a segment of the binary is required it can be swapped in on demand, or "lazy loaded". [Stallings,394]
Short-term Scheduler
The short-term scheduler (also known as the dispatcher) decides which of the ready, in-memory processes are to be executed (allocated a CPU) next following a clock interrupt, an IO interrupt, an operating
system call or another form of
signal. Thus the short-term scheduler makes scheduling decisions much more frequently than the long-term or mid-term schedulers - a scheduling decision will at a minimum have to be made after every time slice, and these are very short. This scheduler can be
preemptive, implying that it's capable of forcibly removing processes from a CPU when it decides to allocate that CPU to another process, or non-preemptive, in which case the scheduler is unable to "force" processes off the CPU. [Stallings,396].
Scheduling disciplines
Scheduling disciplines are algorithms used for distributing resources among parties which simultaneously and asynchronously request them. Scheduling disciplines are used in
routers (to handle packet traffic) as well as in
operating systems (to share
CPU time among
threads and
processes).
The main purposes of scheduling algorithms are to minimize
resource starvation and to ensure fairness amongst the parties utilizing the resources.
Common scheduling disciplines
The following is a list of common scheduling practices and disciplines:
Operating system scheduler implementations
Different computer operating systems implement different scheduling schemes. Very early
MS-DOS and Microsoft Windows systems were non-multitasking, and as such didn't feature a scheduler.
Windows 3.1 and Mac OS 9 (not Mac OS X) and prior based operating systems used a simple non-preemptive scheduler which requires programmers to instruct their processes to "yield" (give up the CPU) in order for other processes to gain some CPU time. This provided primitive support for multitasking, but didn't provide more advanced scheduling options.
Windows NT-based operating systems use a
multilevel feedback queue. 32 priority levels are defined, 0 through to 31, with priorities 0 through 15 being "normal" priorities and priorities 16 through 31 being
soft realtime priorities, requiring privileges to assign. Users can select 5 of these priorities to assign to a running application from the Task Manager application, or through thread management APIs. The kernel may change the priority level of a thread depending on its I/O and CPU usage and whether it's interactive (for example accepts and responds to input from humans), raising the priority of interactive and I/O bounded processes and lowering that of CPU bound processes, to increase the responsiveness of interactive applications. The scheduler was modified in
Windows Vista to use the cycle counter register of modern processors to keep track of exactly how many CPU cycles a thread has executed, rather than just using an interval-timer interrupt routine.
Early
Unix implementations used a scheduler with multilevel feedback queues with round robin selections within each Feedback Queue. In this system, processes begin in a high priority queue (giving a quick response time to new processes, such as those involved in a single mouse movement or keystroke), and as they spend more time within the system, they're preempted multiple times and placed in lower priority queues. Unfortunately under this system older processes may be starved of CPU time by a continual influx of new processes, although if a system is unable to deal with new processes faster than they arrive, starvation is inevitable anyway. Process priorities could be explicitly set under Unix to one of 40 values, although most modern Unix systems have a higher range of priorities available (Solaris has 160). Instead of the Windows NT 4.0 solution to low priority process starvation (bumping a process to the front of the round robin queue should it be starving), early Unix systems used a more subtle aging system, to slowly increase the priority of a starving process until it was executed, whereupon its priority would be reset to whatever it was before it started starving.
The
Linux kernel had been using an
O(1) scheduler until 2.6.23, at which point it's switching over to the
Completely Fair Scheduler.
Further Information
Get more info on 'Scheduling Computing'.
|
External Link Exchanges
Do you know how hard it is to get a link from a large encyclopaedia? Well we're different and will prove it. To get a link from us just add the following HTML to your site on a relevant page:
<a href="http://scheduling__computing.totallyexplained.com">Scheduling (computing) Totally Explained</a>
Then simply click through this link from your web page. Our crawlers will verify your link, extract the title of your web page and instantly add a link back to it. If you like you can remove the words Totally Explained and embed the link in article text.
As long as your link remains in place, we'll keep our link to you right here. Please play fair - our crawlers are watching. Your site must be closely related to this one's topic. Any kind of spamming, dubious practises or removing the link will result in your link from us being dropped and, potentially, your whole site being banned. |